package cn.taofuxn.sale.bean;

import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

/**
 * ProjectName : GeekSaleSystem
 * PackageName : cn.taofuxn.sale.bean
 * Created by Wong
 * Date: 2018/3/15
 * Time: 15:58
 */
@Entity
@Table(name = "tb_sale_order")
public class TbOrder {
	
	@Id
	@GenericGenerator(name = "IdGenerater",strategy = "cn.taofuxn.sale.util.IdGenerater" ,parameters = {@Parameter(name = "prefix",value = "order")})
	@GeneratedValue(generator = "IdGenerater")
	private String id;
	
	/**
	 * 商品信息
	 */
	@JoinColumn(name = "goodId")
	@OneToOne
	private TbGoods goods;
	
	/**
	 * 顾客信息
	 */
	@JoinColumn(name = "comsumerId")
	@OneToOne(cascade = CascadeType.ALL)
	private TbConsumer comsumer;
	
	/**
	 * 邮费、差价
	 */
	private float postage;
	
	/**
	 * 订单满减价
	 */
	private float fullCutPrice;
	
	/**
	 * 订单总价
	 */
	private float  sumPrice;
	
	/**
	 * 备注信息
	 */
	private String note;
	
	/**
	 * 订单创建时间
	 */
	@CreationTimestamp
	@Temporal(TemporalType.TIMESTAMP)
	private Date   createTime;
	
	public float getFullCutPrice() {
		return fullCutPrice;
	}
	
	public void setFullCutPrice(final float vFullCutPrice) {
		fullCutPrice = vFullCutPrice;
	}
	
	public String getId() {
		return id;
	}
	
	
	public TbGoods getGoods() {
		return goods;
	}
	
	public void setGoods(final TbGoods vGoods) {
		goods = vGoods;
	}
	
	public TbConsumer getComsumer() {
		return comsumer;
	}
	
	public void setComsumer(final TbConsumer vComsumer) {
		comsumer = vComsumer;
	}
	
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(final Date vCreateTime) {
		createTime = vCreateTime;
	}
	
	public void setId(final String vId) {
		id = vId;
	}
	
	public float getSumPrice() {
		return sumPrice;
	}
	
	public void setSumPrice(final float vSumPrice) {
		sumPrice = vSumPrice;
	}
	
	public String getNote() {
		return note;
	}
	
	public void setNote(final String vNote) {
		note = vNote;
	}
	
	public float getPostage() {
		return postage;
	}
	
	public void setPostage(final float vPostage) {
		postage = vPostage;
	}
	
	
}
